<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class ZT_CodaSlider_CodaContainer extends ZT_CodaSlider {

  protected $_tabs = array();

  public function codaContainer($id = null, array $options = array()) {

    if (func_num_args() === 0) {
      return $this;
    } else {
      
      $js = sprintf('%s("#%s").codaSlider(%s);',
                      ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(),
                      $id,
                      $this->encodeJson($options)
              );
      $this->jquery->addOnLoad($js);

      $html = '<div class="coda-slider-wrapper">';
      $html .= '<div class="coda-slider prelaod" id="'.$id.'">';
      foreach ($this->_tabs[$id] as $tab) {
        $content = isset($tab['content']) ? (string) $tab['content'] : '';
        $add = sprintf('<div class="panel"><div class="panel-wrapper">%s</div></div>', $content);
        $html .= $add;
      }
      $html .= '</div></div>';

      return $html;
    }
  }

  public function addPane($id, $options) {
    if (!isset($this->_tabs[$id])) {
      $this->_tabs[$id] = array();
    }
    //$test = &$this->_tabs[$id][];
    //$test = array_push(&$this->_tabs[$id], $options);
    return array_push($this->_tabs[$id], $options);
  }

}
